/**
 * Debug类，用于打印调试信息
 * 
 */


package com.example.util;

public class Debug {

    private static final boolean isDebug = true;

    public static final String[] UPDATE_WORDS = { "INSERT", "DELETE", "UPDATE" };

    public static void print(Object... args) {
        if (!isDebug) {
            return;
        }
        String str = "";
        for (Object item : args) {
            if (item instanceof String[]) {
                str += printarr((String[]) item) + " ";
            } else {
                str += item.toString() + " ";
            }
        }
        System.out.println(str);
    }

    private static String printarr(Object[] arr) {
        String str = "[";
        if (arr instanceof String[]) {
            for (Object item : arr) {
                str += "\"" + item + "\", ";
            }
        } else {
            for (Object item : arr) {
                str += item.toString() + ", ";
            }
        }
        str += "\b\b]";
        return str;
    }

    public static <T> void print(T msg) {
        if (isDebug) {
            System.out.printf(msg + "\n");
        }
    }

    public static <T> void printf(T msg, Object... args) {
        if (isDebug) {
            System.out.printf(msg + "\n", args);
        }
    }

}
